
import {KgMobileCall} from "../../../utils/mobilecall/mobilecall-2.2";
import {nativeCall} from "../../../utils/httpWeb";
import { dkShare } from '../../../utils/CallUpShortVideo';

export function kgShareFun(shareData) {
  shareData = {
    title:'分享标题',
    desc:'分享文案',
    link:shareData.linkUrl,
    image: shareData.picUrl,
    
  }
  let imgShareData = {
    image: 'http://s3.fx.kgimg.com/v2/fxroomcover/2de3d4bd4717a3d8e45c90722d6e922e.jpg',
    link: 'http://mfanxing.kugou.com/staticPub/rmobile/shortVideo/views/index.html?pageType=0&fromType=duanku&videoId=72e50881ab914e68b42440d7b6e98d76&sharetime=1544606249641',
    title:'',
    desc: '',
    type: 2
  }
  let sData = {shareList: ['onShareImage', 'onShareWechat', 'onShareTimeline', 'onShareQQ', 'onShareQzone', 'onShareSina'],
  onShareImage: imgShareData,
  onShareWechat: shareData,
  onShareTimeline: shareData,
  onShareQQ: shareData,
  onShareQzone: shareData, 
  onShareSina: shareData,}
    let shareObj = {
        shareName: "",
        hash: "",
        listID: "",
        type: 6,
        shareData: sData,
        suid: "",
        slid: "",
        imgUrl: "",
        filename: "",
        duration: "",
        topicName: ""
    };
    KgMobileCall.share(shareObj);
}

export function fxShareFun(shareData, sign) {
    let shareObject = {
        image: shareData.picUrl,
        link: shareData.linkUrl,
        desc: shareData.content,
        title: shareData.title
    };
    //客户端读取的全局变量参数
    window.fxShareConfig = {
        shareList: ["onShareWechat", "onShareTimeline", "onShareQQ", "onShareQzone", "onShareSina"],
        onShareWechat: shareObject,
        onShareTimeline: shareObject,
        onShareQQ: shareObject,
        onShareQzone: shareObject,
        onShareSina: shareObject
    };

    let nativeCallOptions = {
        cmd: 610,
        data: window.fxShareConfig,
        sign: sign,
        callbackName: "mobilecall_share"
    };
    nativeCall(nativeCallOptions);
}
export function dkShareFun (shareData) {
    let shareObject = {
        image: shareData.picUrl,
        link: shareData.linkUrl,
        desc: shareData.content,
        title: shareData.title
    };
    //客户端读取的全局变量参数
    window.fxShareConfig = {
        shareList: ["onShareWechat", "onShareTimeline", "onShareQQ", "onShareQzone", "onShareSina"],
        onShareWechat: shareObject,
        onShareTimeline: shareObject,
        onShareQQ: shareObject,
        onShareQzone: shareObject,
        onShareSina: shareObject
    };
    dkShare(window.fxShareConfig)
}
export default {
    kgShareFun,
    fxShareFun,
    dkShareFun
};
